package com.dotflat.refund.domain;

import com.dotflat.fin.domain.RefundRecord;
import com.dotflat.rest.domain.AreableObjectBase;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;

/**
 * 退费记录条目
 */

@Data
@Entity
@Table(name="fin_refund_record_item")
@EqualsAndHashCode(callSuper = true)
public class RefundRecordItem extends AreableObjectBase  {

    @Column(columnDefinition = "varchar(32) COMMENT '退款单 id'")
    @ApiModelProperty("记录 id")
    private String recordId;

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "recordId", columnDefinition = "varchar(32) COMMENT '退款单 id'", insertable = false, updatable = false)
    @ApiModelProperty(hidden = true)
    @JsonIgnore
    private RefundRecord record;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '合同 id'")
    @ApiModelProperty("合同 id")
    private String contractId;

    @Column(columnDefinition = "VARCHAR(32) COMMENT '产品 id'")
    @ApiModelProperty("产品 id")
    private String productId;

    @Column(columnDefinition = "VARCHAR(128) COMMENT '退费项目'", nullable = false)
    @ApiModelProperty("退费项目")
    private String title;

    @Column(columnDefinition = "VARCHAR(128) COMMENT '项目说明'")
    @ApiModelProperty("项目说明")
    private String description;

    @Column(columnDefinition = "INT default 0 COMMENT '原支付金额'")
    @ApiModelProperty("原支付金额")
    private Long amount = 0L;

    @Column(columnDefinition = "INT default 0 COMMENT '退费金额'")
    @ApiModelProperty("退费金额")
    private Long refundAmount = 0L;

    @Column(columnDefinition = "VARCHAR(128) COMMENT '退费说明'")
    @ApiModelProperty("退费说明")
    private String refundRemark;

}